feat: [Remote rendering 3.4] server-owned UI panel and theme state - #144
Conversation
cfe1768 to
ed65753
Compare
b87c85f to
b9222fd
Compare
142bdea to
b4b6d72
Compare
de98f34 to
9fa3ad4
Compare
96e4088 to
1f0c1b3
Compare
8b0e846 to
c117749
Compare
b34ffb1 to
6c15e9f
Compare
c117749 to
e64851b
Compare
e64851b to
1916c0e
Compare
ansBAkula
left a comment
There was a problem hiding this comment.
Great work. Now that all (most) UI actions are synced back instantaneously, going forward the save and load state end points are probably not needed? Is my understanding correct ?
|
Thanks @ansBAkula. Yes the UI actions are now synced in real time within a running session. But good question. The save/load state endpoints have a separate function, of persisting the state to disk. That way if a user wants to shut down their current session, and preserve the full browser state, they can save the state to disk, and then restore it in a new process (or even on a new machine). In this PR, the UI state is now a) synced back to the server by the browser on any of the panel/tab changes (ie keeping the runtime state up-to-date on the server) and b) having the server read from its own records (rather than the browser's copy) when a user calls |
1916c0e to
f5cf3cb
Compare
Issue
Resolves #22
Context
This is user story 4 in Phase 3 of the remote rendering epic, where the viewer state ownership is moved from client to server. 3.4 sees the panel layout and theme become server-authoritative.
Previously, the UI state was read from the browser on
save_stateand written into the persisted state, and was passed back through to the viewer onload_state, but the server itself held no record of it. This PR changes that: it adds a server-side record for the UI panel state, has the client sync it on panel collapse/expand and tab selection, seeds the browser from it on a refresh and rebuild, and uses it for save/load. The dark theme gets no trigger, as no control exists on the browser, and the server already owns dark_mode, sosave_statenow records the server's value rather than the browser's.Fixed, pre-existing:
Copilot summary
This pull request introduces server-owned UI panel and theme state management for remote rendering, enhancing consistency and reliability in the UI's appearance and layout. The main changes implement a unified
VisorUIStatemodel on the server, which now tracks theme and panel layout state, and ensures these are synchronized between frontend and backend. This involves new payload models, updated state handling, and refactored state application and retrieval logic.UI State Management Enhancements
VisorUIStatemodel to hold theme and panel layout state on the server, replacing separatedark_modehandling and ensuring all UI state is owned and managed centrally. (src/ansys/visor/viewer/vtk/scene/base.py,src/ansys/visor/viewer/models/common/visor_ui_state.py)from_components,apply_state,get_state,get_scene_details) to use the unifiedVisorUIStateobject, passing the full UI state record rather than individual fields. (src/ansys/visor/viewer/models/runtime/scene/runtime_app_state.py,src/ansys/visor/viewer/models/runtime/visor_scene_details.py,src/ansys/visor/viewer/vtk/scene/base.py) [1] [2] [3]Panel Layout State Synchronization
SetPanelTopLeftPanelCollapsedPayload,SetPanelTopRightPanelCollapsedPayload,SetPanelTopRightLegendCollapsedPayload, andSetPanelTopRightTabIndexPayload, each carrying the relevant UI state from frontend to backend. (src/ansys/visor/viewer/models/runtime/requests/widget_state_payloads.py)LocalAppto receive and apply these panel layout state changes from the frontend. (src/ansys/visor/viewer/app/trame/local_app.py)These changes collectively ensure that the server is the source of truth for UI theme and panel layout, improving synchronization and reliability in multi-user or remote rendering scenarios.